-
Notifications
You must be signed in to change notification settings - Fork 21
Add FAQ about slow joins #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Querying across relational fields like :class:`~django.db.models.ForeignKey` and :class:`~django.db.models.ManyToManyField` is really slow. Is there a way to improve the speed of these joins? | ||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
|
||
Not really. Joins use MongoDB's :doc:`$lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: "Not really."
We could mention the possibility of using raw_aggregate()
to manually construct a query as mentioned in #309, but I think that's unlikely to be an attractive and maintainable solution for most projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 we could, the people then will ask: why aren't you doing that approach?
The answer is: because we have to modify the django query tree or handle this particular case differently. IMO keep this as it is now, otherwise we should explain the limitations that we have in this particular case.
27f8d17
to
84c8299
Compare
Some discussion in #309.